import request from '@/utils/request'
// 注册
export const register = (params) => {
  return request({
    url: '/v1/user/register',
    method: 'post',
    headers: {
      secret: '5yuy675489834ert'
    },
    data: params
  })
}
// 登录
export const loginWithAccount = (params) => {
  return request({
    url: '/v1/user/loginWithAccount',
    method: 'post',
    headers: {
      secret: '5yuy675489834ert'
    },
    data: params
  })
}
// 三方登录
export const thirdLogin = (params) => {
  return request({
    url: '/v1/third/index',
    method: 'get',
    params
  })
}
// 登录器三方登录
export const thirdMicroLogin = (params) => {
  return request({
    url: '/v1/third/microIndex',
    method: 'get',
    params
  })
}
// 发送邮件
export const sendMessage = (params) => {
  return request({
    url: '/v1/base/sendEmailCode',
    method: 'post',
    data:params
  })
}
// 登录状态下发送邮件
export const sendMessageWhenLogin = (params) => {
  return request({
    url: '/v1/token/user/sendEmailCode',
    method: 'get',
    params
  })
}
// 校验邮箱是否已被使用
export const checkEmailIsUsed = (params) => {
  return request({
    url: '/v1/user/checkEmailIsUsed',
    method: 'get',
    params
  })
}
export const exchangeToken = (data, token) => {
  return request({
    url: '/v1/user/checkEmailIsUsed',
    method: 'get',
    headers: {
      token
    },
    data
  })
}
export const refreshClientToken = (data, token) => {
  return request({
    url: '/v1/token/user/refresh',
    method: 'get',
    headers: {
      token
    },
    data
  })
}
// $.ajax({
//   url: `/v1/token/user/refresh?${obj2Params(data)}`,
//   method: 'GET',
//   headers: {
//     token
//   },
//   success: cb
// });
